//
//  NSView+frame.swift
//  onemeetingmac
//
//  Created by 张衡 on 2020/3/13.
//  Copyright © 2020 onemeeting. All rights reserved.
//

import Foundation

extension NSView {
    
    func gcenterX() -> CGFloat {
        return self.frame.origin.x+self.frame.size.width/2
    }
    
    func gcenterY() -> CGFloat {
        return self.frame.origin.y+self.frame.size.height/2
    }
    
    func gcenter() -> NSPoint {
        return NSPoint.init(x: gcenterX(), y: gcenterY())
    }
    
}

extension NSWindow {
    
    func gcenterX() -> CGFloat {
        return self.frame.size.width/2
    }
    
    func gcenterY() -> CGFloat {
        return self.frame.size.height/2
    }
    
    func gcenter() -> NSPoint {
        return NSPoint.init(x: gcenterX(), y: gcenterY())
    }
    
}
